package com.ksana.context.support;

import com.ksana.bean.BeanException;
import com.ksana.bean.factory.config.ConfigurableListableBeanFactory;
import com.ksana.bean.factory.xml.XmlBeanDefinitionReader;
import com.ksana.core.ClassResource;
import com.ksana.core.DefaultResourceLoader;
import com.ksana.core.Resource;

import java.util.Map;

public class ClassPathXmlApplicationContext extends AbstractXmlApplicationContext {
    private Resource[] configResources;

    public ClassPathXmlApplicationContext(String configLocations) {
        this(new String[] {configLocations});
    }

    public ClassPathXmlApplicationContext(String... configLocations) {
        this.configResources = new Resource[configLocations.length];
        DefaultResourceLoader defaultResourceLoader = new DefaultResourceLoader();
        for (int i = 0; i < configLocations.length; i++) {
            this.configResources[i] = defaultResourceLoader.getResource(configLocations[i]);
        }
        refresh();
    }

    @Override
    protected Resource[] getConfigResources() {
        return this.configResources;
    }
}
